<?php
namespace Controllers\Admin;

/**
 * @author Eugene Baranov <evgeny@baranov.ru>
 */
abstract class Base extends \Controllers\Base {

    public function __construct() {
        if (!($u = \App::getCurrentUser()) || !$u->isAdmin()) {
            \App::error(403, "You are not authorized to access admin area.");
        }
        parent::__construct();
    }

    /**
     * @param string $name
     * @return \Controllers\Base
     */
    final public function setView($name) {
        $this->view = 'Admin' . NS . $name;
        return $this;
    }
}
